<template>
  <div class="classification">
    <myhead title="分类"></myhead>
    <div class="main">
      <!-- <van-sidebar v-model="activeKey" v-for="(l, i) in chuichui" :key="i">
        <van-sidebar-item :title="l.classifyName" />
      </van-sidebar> -->
      <van-sidebar v-model="activeKey">
        <van-sidebar-item
          v-for="(l, i) in left"
          :key="i"
          :title="l.classifyName"
          @click="onChange"
        />
      </van-sidebar>
      <div class="main_right">
        <div class="bar" v-if="chuichui">
          <img class="img" :src="imageUrl" alt="" />
          <div class="bar_mains">
            <div
              v-for="m in chuichui.second"
              :key="m.classifyId"
              class="bar_main"
            >
              <div class="bar_main-img">
                <h3>{{ m.classifyName }}</h3>
                <div class="biub">
                  <div
                  @click="gotofilm(l.spuList[0])"
                    v-for="l in m.third"
                    :key="l.classifyId"
                    class="biub-img"
                  >
                    <img v-if="m.third" :src="l.image" alt="" />
                    <p>{{ l.classifyName }}</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
export default {
  data() {
    return {
      chuichui: [],
      activeKey: 0,
      left: [],
      imageUrl: "",
      ids:null
    };
  },
  methods: {
    onChange(index) {
      this.chuichui = this.left[index];
      this.imageUrl = this.chuichui.banner[0].image;
      console.log(this.chuichui);
    },
  },
  created() {
    this.$ajax.getchuichui().then((res) => {
      this.left = res.data;
      this.onChange(0);
    });
  },
};
</script>

<style lang="scss" scoped>
.main {
  display: flex;
  .main_right {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
  }
  .img {
    width: 240px;
    height: 80px;
    margin: auto;
    border-radius: 10px;
  }
  .bar {
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    flex-direction: column;
    height: 100%;
    overflow: auto;
    .bar_mains {
      display: flex;
      flex-wrap: wrap;
      flex-direction: column;
      overflow: auto;
      // height: 100%;
    }
    .bar-h3 {
      width: 30%;
    }
    .bar_mains {
      .bar_main {
        width: 30%;
        display: flex;
        .bar_main-img {
          text-align: center;
          img {
            width: 100px;
          }
          p {
            font-size: 15px;
          }
        }
        .biub {
          display: flex;
          flex-wrap: wrap;
          width: 8rem;
        }
      }
    }
  }
}
</style>